(function($){  

	$.fn.uniqid = function(options) {
		// iterate and set ID for each element
		return this.each(function() {
			$(this).attr('id', 'guid-' + $.uniqid.generate());
		});
	};
    
	
	// *********** PUBLIC
	// ************************************************************************
	
	$.uniqid = {};
	$.uniqid.created = [];
	$.uniqid.generate = function() {
		var result, i, j; 
		result = ""; 
		while (!j || $.uniqid.created.indexOf(result) >= 0) { 
			result = ""; 
			for(j=0; j<32; j++) { 
				if( j == 8 || j == 12|| j == 16|| j == 20) { result = result + "-"; } 
				i = Math.floor(Math.random()*16).toString(16).toUpperCase(); 
				result = result + i; 
			} 
		} 
	
		// Add the GUID to our master index
		$.uniqid.created.push(result);
		return result;
	}
    
      
})(jQuery);  